<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // var res=[7,8,4,5,3,2,1]
        // for(var a=0;a<res.length-1;a++){
        //     for(var b=0;b<res.length-a-1;b++){
        //         if(res[b]>res[b+1]){
        //             var sum=res[b];
        //             res[b]=res[b+1];
        //             res[b+1]=sum;

        //         }
        //     }
        // }console.log(res);
    // var res=[7,8,4,5,3,2,1]
    // for(var a=0;a<res.length-1;a++){
    //     for(var b=0;b<res.length-a-1;b++){
    //         if(res[b]>res[b+1]){
    //             var sum=res[b]
    //             res[b]=res[b+1]
    //            res[b+1]=sum
    //         }
    //     }
    // }console.log(res);

    var res=[7,8,4,5,3,2,1]
    for(var a=0;a<res.length-1;a++){
        for(var b=0;res.length-a-1;b++){
            if(res[b]>res[b+1]){
                var num=res[b]
                res[b]=res[b+1]
                res[b+1]=num;
            }
        }
    }console.log(res)

    
    var res=[7,8,4,5,3,2,1]
    for(var a=0;a<res.length-1;a++){
    for(var b=0;b<res.length-a-1;b++){
        if(res[b]>res[b+1]){
            var sum=res[b]
           res[b]=res[b+1]
           res[b+1]=sum
            
        }
    }
    }
    console.log(res)

    var res=[7,8,4,5,3,2,1]
 for(var x=0;x<res.length-1;x++){
    for()
 }



    </script>
</body>
</html>